package com.bean;


import io.ebean.Model;
import io.ebean.annotation.CreatedTimestamp;
import io.ebean.annotation.UpdatedTimestamp;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.util.Date;

@Getter @Setter
@MappedSuperclass
public abstract class BaseModel extends Model {

  //物理主键
  @Id
  @Column(name = "id")
  Long id;

  @CreatedTimestamp
  @Temporal(TemporalType.TIMESTAMP)
  @Column(name = "created_time")
  Date createdTime;

  @UpdatedTimestamp
  @Temporal(TemporalType.TIMESTAMP)
  @Column(name = "updated_time")
  Date updatedTime;

  @Column(name = "remark", length = 500)
  String remark;


  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;
    if (getClass() != obj.getClass()) return false;
    final BaseModel other = (BaseModel) obj;
    if (this.id != other.id) return false;
    return true;
  }

}
